<template>
    <div class="menu">
      <div v-for="(item,index) in menu_list"
          :key="index"
          @click="test(item.miniWallkey,index,item.maitKey)"
          class="item"
          :class="{menu_style:index===currentIndex}">
        {{item.title}}

      </div>
    </div>
</template>

<script>
  export default {
    name: "CategoryMenu",
    props: {
      menu_list: {
        type: Array,
        default: []
      }
    },
    data(){
      return{
        currentIndex:0
      }
    },
    methods: {
      test(miniWallkey,index,maitKey) {
        this.currentIndex = index
        this.$emit('getSubcategory', miniWallkey,maitKey)

      }
    }
  }
</script>

<style scoped>
  .menu {
    display: flex;
    flex-direction: column;
    /*position: absolute;*/
    align-items: center;
    list-style-type: none;
    text-align: center;
    background-color: #F5F5F5;
  }

  .menu .item {
    line-height: 50px;
    width: 100%;
    height: 50px;

  }
  .menu_style{
    border-left: 4px solid var(--color-tint);
    color: var(--color-tint);
    font-weight: 600;
    background-color: #ffffff;
  }

</style>
